<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-2"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- Module      :  GHC.ExecutionStack.Internal</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow 2013-2015</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Portability :  non-portable (GHC Extensions)</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Internals of the `GHC.ExecutionStack` module</span><span>
</span><span id="line-12"></span><span class="hs-comment">--</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- @since 4.9.0.0</span><span>
</span><span id="line-14"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span>
</span><span id="line-17"></span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-pragma">{-# LANGUAGE MultiWayIf #-}</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.ExecutionStack.Internal</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-23"></span><span>  </span><span class="annot"><span class="hs-comment">-- * Internal</span></span><span>
</span><span id="line-24"></span><span>    </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier">Location</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#SrcLoc"><span class="hs-identifier">SrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier">StackTrace</span></a></span><span>
</span><span id="line-27"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#stackFrames"><span class="hs-identifier">stackFrames</span></a></span><span>
</span><span id="line-28"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#stackDepth"><span class="hs-identifier">stackDepth</span></a></span><span>
</span><span id="line-29"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#collectStackTrace"><span class="hs-identifier">collectStackTrace</span></a></span><span>
</span><span id="line-30"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#showStackFrames"><span class="hs-identifier">showStackFrames</span></a></span><span>
</span><span id="line-31"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#invalidateDebugCache"><span class="hs-identifier">invalidateDebugCache</span></a></span><span>
</span><span id="line-32"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.html"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Base.html#join"><span class="hs-identifier">join</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Word.html"><span class="hs-identifier">Data.Word</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Foreign.C.Types.html"><span class="hs-identifier">Foreign.C.Types</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Foreign.C.String.html"><span class="hs-identifier">Foreign.C.String</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Foreign.C.String.html#peekCString"><span class="hs-identifier">peekCString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CString"><span class="hs-identifier">CString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Foreign.Ptr.html"><span class="hs-identifier">Foreign.Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier">Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Ptr.html#nullPtr"><span class="hs-identifier">nullPtr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Ptr.html#castPtr"><span class="hs-identifier">castPtr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Ptr.html#plusPtr"><span class="hs-identifier">plusPtr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Ptr.html#FunPtr"><span class="hs-identifier">FunPtr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Foreign.ForeignPtr.html"><span class="hs-identifier">Foreign.ForeignPtr</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Foreign.Marshal.Alloc.html"><span class="hs-identifier">Foreign.Marshal.Alloc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Foreign.Marshal.Alloc.html#allocaBytes"><span class="hs-identifier">allocaBytes</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Foreign.Storable.html"><span class="hs-identifier">Foreign.Storable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Foreign.Storable.html#Storable"><span class="hs-identifier">Storable</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.IO.Unsafe.html"><span class="hs-identifier">System.IO.Unsafe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier">unsafePerformIO</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.IO.Unsafe.html#unsafeInterleaveIO"><span class="hs-identifier">unsafeInterleaveIO</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span class="hs-comment">-- N.B. See includes/rts/Libdw.h for notes on stack representation.</span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span class="hs-comment">-- | A location in the original program source.</span><span>
</span><span id="line-47"></span><span class="hs-keyword">data</span><span> </span><span id="SrcLoc"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#SrcLoc"><span class="hs-identifier hs-var">SrcLoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="SrcLoc"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#SrcLoc"><span class="hs-identifier hs-var">SrcLoc</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="sourceFile"><span class="annot"><span class="annottext">SrcLoc -&gt; String
</span><a href="GHC.ExecutionStack.Internal.html#sourceFile"><span class="hs-identifier hs-var hs-var">sourceFile</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-48"></span><span>                     </span><span class="hs-special">,</span><span> </span><span id="sourceLine"><span class="annot"><span class="annottext">SrcLoc -&gt; Int
</span><a href="GHC.ExecutionStack.Internal.html#sourceLine"><span class="hs-identifier hs-var hs-var">sourceLine</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-49"></span><span>                     </span><span class="hs-special">,</span><span> </span><span id="sourceColumn"><span class="annot"><span class="annottext">SrcLoc -&gt; Int
</span><a href="GHC.ExecutionStack.Internal.html#sourceColumn"><span class="hs-identifier hs-var hs-var">sourceColumn</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-50"></span><span>                     </span><span class="hs-special">}</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span class="hs-comment">-- | Location information about an address from a backtrace.</span><span>
</span><span id="line-53"></span><span class="hs-keyword">data</span><span> </span><span id="Location"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-var">Location</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Location"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-var">Location</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="objectName"><span class="annot"><span class="annottext">Location -&gt; String
</span><a href="GHC.ExecutionStack.Internal.html#objectName"><span class="hs-identifier hs-var hs-var">objectName</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-54"></span><span>                         </span><span class="hs-special">,</span><span> </span><span id="functionName"><span class="annot"><span class="annottext">Location -&gt; String
</span><a href="GHC.ExecutionStack.Internal.html#functionName"><span class="hs-identifier hs-var hs-var">functionName</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-55"></span><span>                         </span><span class="hs-special">,</span><span> </span><span id="srcLoc"><span class="annot"><span class="annottext">Location -&gt; Maybe SrcLoc
</span><a href="GHC.ExecutionStack.Internal.html#srcLoc"><span class="hs-identifier hs-var hs-var">srcLoc</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#SrcLoc"><span class="hs-identifier hs-type">SrcLoc</span></a></span><span>
</span><span id="line-56"></span><span>                         </span><span class="hs-special">}</span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span class="hs-comment">-- | A chunk of backtrace frames</span><span>
</span><span id="line-59"></span><span class="hs-keyword">data</span><span> </span><span id="Chunk"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Chunk"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="chunkFrames"><span class="annot"><span class="annottext">Chunk -&gt; Word
</span><a href="GHC.ExecutionStack.Internal.html#chunkFrames"><span class="hs-identifier hs-var hs-var">chunkFrames</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span>
</span><span id="line-60"></span><span>                   </span><span class="hs-special">,</span><span> </span><span id="chunkNext"><span class="annot"><span class="annottext">Chunk -&gt; Ptr Chunk
</span><a href="GHC.ExecutionStack.Internal.html#chunkNext"><span class="hs-identifier hs-var hs-var">chunkNext</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span>                   </span><span class="hs-special">,</span><span> </span><span id="chunkFirstFrame"><span class="annot"><span class="annottext">Chunk -&gt; Ptr Addr
</span><a href="GHC.ExecutionStack.Internal.html#chunkFirstFrame"><span class="hs-identifier hs-var hs-var">chunkFirstFrame</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Addr"><span class="hs-identifier hs-type">Addr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-62"></span><span>                   </span><span class="hs-special">}</span><span>
</span><span id="line-63"></span><span>
</span><span id="line-64"></span><span class="hs-comment">-- | The state of the execution stack</span><span>
</span><span id="line-65"></span><span class="hs-keyword">newtype</span><span> </span><span id="StackTrace"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-var">StackTrace</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="StackTrace"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-var">StackTrace</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier hs-type">ForeignPtr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span class="hs-comment">-- | An address</span><span>
</span><span id="line-68"></span><span class="hs-keyword">type</span><span> </span><span id="Addr"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Addr"><span class="hs-identifier hs-var">Addr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span id="local-6989586621679566897"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#withSession"><span class="hs-identifier hs-type">withSession</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier hs-type">ForeignPtr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Session"><span class="hs-identifier hs-type">Session</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566897"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566897"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-71"></span><span id="withSession"><span class="annot"><span class="annottext">withSession :: forall a. (ForeignPtr Session -&gt; IO a) -&gt; IO (Maybe a)
</span><a href="GHC.ExecutionStack.Internal.html#withSession"><span class="hs-identifier hs-var hs-var">withSession</span></a></span></span><span> </span><span id="local-6989586621679566728"><span class="annot"><span class="annottext">ForeignPtr Session -&gt; IO a
</span><a href="#local-6989586621679566728"><span class="hs-identifier hs-var">action</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-72"></span><span>    </span><span id="local-6989586621679566727"><span class="annot"><span class="annottext">Ptr Session
</span><a href="#local-6989586621679566727"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (Ptr Session)
</span><a href="GHC.ExecutionStack.Internal.html#libdw_pool_take"><span class="hs-identifier hs-var">libdw_pool_take</span></a></span><span>
</span><span id="line-73"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Ptr Session
forall a. Ptr a
</span><a href="GHC.Ptr.html#nullPtr"><span class="hs-identifier hs-var">nullPtr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Session -&gt; Ptr Session -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Session
</span><a href="#local-6989586621679566727"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IO (Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-74"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-75"></span><span>           </span><span id="local-6989586621679566725"><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566725"><span class="hs-identifier hs-var">fptr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FinalizerPtr Session -&gt; Ptr Session -&gt; IO (ForeignPtr Session)
forall a. FinalizerPtr a -&gt; Ptr a -&gt; IO (ForeignPtr a)
</span><a href="Foreign.ForeignPtr.Imp.html#newForeignPtr"><span class="hs-identifier hs-var">newForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">FinalizerPtr Session
</span><a href="GHC.ExecutionStack.Internal.html#libdw_pool_release"><span class="hs-identifier hs-var">libdw_pool_release</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Session
</span><a href="#local-6989586621679566727"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-76"></span><span>           </span><span id="local-6989586621679566722"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679566722"><span class="hs-identifier hs-var">ret</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session -&gt; IO a
</span><a href="#local-6989586621679566728"><span class="hs-identifier hs-var">action</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566725"><span class="hs-identifier hs-var">fptr</span></a></span><span>
</span><span id="line-77"></span><span>           </span><span class="annot"><span class="annottext">Maybe a -&gt; IO (Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe a -&gt; IO (Maybe a)) -&gt; Maybe a -&gt; IO (Maybe a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679566722"><span class="hs-identifier hs-var">ret</span></a></span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span class="hs-comment">-- | How many stack frames in the given 'StackTrace'</span><span>
</span><span id="line-80"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#stackDepth"><span class="hs-identifier hs-type">stackDepth</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-81"></span><span id="stackDepth"><span class="annot"><span class="annottext">stackDepth :: StackTrace -&gt; Int
</span><a href="GHC.ExecutionStack.Internal.html#stackDepth"><span class="hs-identifier hs-var hs-var">stackDepth</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span> </span><span id="local-6989586621679566721"><span class="annot"><span class="annottext">ForeignPtr StackTrace
</span><a href="#local-6989586621679566721"><span class="hs-identifier hs-var">fptr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-82"></span><span>    </span><span class="annot"><span class="annottext">IO Int -&gt; Int
forall a. IO a -&gt; a
</span><a href="GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO Int -&gt; Int) -&gt; IO Int -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr StackTrace -&gt; (Ptr StackTrace -&gt; IO Int) -&gt; IO Int
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="GHC.ForeignPtr.html#withForeignPtr"><span class="hs-identifier hs-var">withForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr StackTrace
</span><a href="#local-6989586621679566721"><span class="hs-identifier hs-var">fptr</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr StackTrace -&gt; IO Int) -&gt; IO Int)
-&gt; (Ptr StackTrace -&gt; IO Int) -&gt; IO Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679566719"><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566719"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-83"></span><span>        </span><span class="annot"><span class="annottext">Word -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">(Word -&gt; Int) -&gt; (Word -&gt; Word) -&gt; Word -&gt; Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word
</span><a href="#local-6989586621679566717"><span class="hs-identifier hs-var">asWord</span></a></span><span> </span><span class="annot"><span class="annottext">(Word -&gt; Int) -&gt; IO Word -&gt; IO Int
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679566715"><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566715"><span class="hs-identifier hs-var">hsc_ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace -&gt; Int -&gt; IO Word
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; IO a
</span><a href="Foreign.Storable.html#peekByteOff"><span class="hs-identifier hs-var">peekByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566715"><span class="hs-identifier hs-var">hsc_ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566719"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-84"></span><span class="hs-pragma">{-# LINE 84 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-84"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-85"></span><span>    </span><span id="local-6989586621679566717"><span class="annot"><span class="annottext">asWord :: Word -&gt; Word
</span><a href="#local-6989586621679566717"><span class="hs-identifier hs-var hs-var">asWord</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word
forall a. a -&gt; a
</span><a href="GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#peekChunk"><span class="hs-identifier hs-type">peekChunk</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span>
</span><span id="line-88"></span><span id="peekChunk"><span class="annot"><span class="annottext">peekChunk :: Ptr Chunk -&gt; IO Chunk
</span><a href="GHC.ExecutionStack.Internal.html#peekChunk"><span class="hs-identifier hs-var hs-var">peekChunk</span></a></span></span><span> </span><span id="local-6989586621679566711"><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566711"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-89"></span><span>    </span><span class="annot"><span class="annottext">Word -&gt; Ptr Chunk -&gt; Ptr Addr -&gt; Chunk
</span><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">(Word -&gt; Ptr Chunk -&gt; Ptr Addr -&gt; Chunk)
-&gt; IO Word -&gt; IO (Ptr Chunk -&gt; Ptr Addr -&gt; Chunk)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679566710"><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566710"><span class="hs-identifier hs-var">hsc_ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr Chunk -&gt; Int -&gt; IO Word
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; IO a
</span><a href="Foreign.Storable.html#peekByteOff"><span class="hs-identifier hs-var">peekByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566710"><span class="hs-identifier hs-var">hsc_ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566711"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-90"></span><span class="hs-pragma">{-# LINE 90 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-90"></span><span>          </span><span class="annot"><span class="annottext">IO (Ptr Chunk -&gt; Ptr Addr -&gt; Chunk)
-&gt; IO (Ptr Chunk) -&gt; IO (Ptr Addr -&gt; Chunk)
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679566709"><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566709"><span class="hs-identifier hs-var">hsc_ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr Chunk -&gt; Int -&gt; IO (Ptr Chunk)
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; IO a
</span><a href="Foreign.Storable.html#peekByteOff"><span class="hs-identifier hs-var">peekByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566709"><span class="hs-identifier hs-var">hsc_ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566711"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-91"></span><span class="hs-pragma">{-# LINE 91 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-91"></span><span>          </span><span class="annot"><span class="annottext">IO (Ptr Addr -&gt; Chunk) -&gt; IO (Ptr Addr) -&gt; IO Chunk
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Addr -&gt; IO (Ptr Addr)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Any -&gt; Ptr Addr
forall a b. Ptr a -&gt; Ptr b
</span><a href="GHC.Ptr.html#castPtr"><span class="hs-identifier hs-var">castPtr</span></a></span><span> </span><span class="annot"><span class="annottext">(Ptr Any -&gt; Ptr Addr) -&gt; Ptr Any -&gt; Ptr Addr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679566708"><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566708"><span class="hs-identifier hs-var">hsc_ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566708"><span class="hs-identifier hs-var">hsc_ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Chunk -&gt; Int -&gt; Ptr Any
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">16</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566711"><span class="hs-identifier hs-var">ptr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-92"></span><span class="hs-pragma">{-# LINE 92 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-comment">-- | Return a list of the chunks of a backtrace, from the outer-most to</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- inner-most chunk.</span><span>
</span><span id="line-95"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#chunksList"><span class="hs-identifier hs-type">chunksList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-96"></span><span id="chunksList"><span class="annot"><span class="annottext">chunksList :: StackTrace -&gt; IO [Chunk]
</span><a href="GHC.ExecutionStack.Internal.html#chunksList"><span class="hs-identifier hs-var hs-var">chunksList</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span> </span><span id="local-6989586621679566706"><span class="annot"><span class="annottext">ForeignPtr StackTrace
</span><a href="#local-6989586621679566706"><span class="hs-identifier hs-var">fptr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ForeignPtr StackTrace
-&gt; (Ptr StackTrace -&gt; IO [Chunk]) -&gt; IO [Chunk]
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="GHC.ForeignPtr.html#withForeignPtr"><span class="hs-identifier hs-var">withForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr StackTrace
</span><a href="#local-6989586621679566706"><span class="hs-identifier hs-var">fptr</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr StackTrace -&gt; IO [Chunk]) -&gt; IO [Chunk])
-&gt; (Ptr StackTrace -&gt; IO [Chunk]) -&gt; IO [Chunk]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679566705"><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566705"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-97"></span><span>    </span><span class="annot"><span class="annottext">[Chunk] -&gt; Ptr Chunk -&gt; IO [Chunk]
</span><a href="#local-6989586621679566704"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(Ptr Chunk -&gt; IO [Chunk]) -&gt; IO (Ptr Chunk) -&gt; IO [Chunk]
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679566702"><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566702"><span class="hs-identifier hs-var">hsc_ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace -&gt; Int -&gt; IO (Ptr Chunk)
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; IO a
</span><a href="Foreign.Storable.html#peekByteOff"><span class="hs-identifier hs-var">peekByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566702"><span class="hs-identifier hs-var">hsc_ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566705"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-98"></span><span class="hs-pragma">{-# LINE 98 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-98"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-99"></span><span>    </span><span id="local-6989586621679566704"><span class="annot"><span class="annottext">go :: [Chunk] -&gt; Ptr Chunk -&gt; IO [Chunk]
</span><a href="#local-6989586621679566704"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679566698"><span class="annot"><span class="annottext">[Chunk]
</span><a href="#local-6989586621679566698"><span class="hs-identifier hs-var">accum</span></a></span></span><span> </span><span id="local-6989586621679566697"><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566697"><span class="hs-identifier hs-var">ptr</span></a></span></span><span>
</span><span id="line-100"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566697"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Chunk -&gt; Ptr Chunk -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
forall a. Ptr a
</span><a href="GHC.Ptr.html#nullPtr"><span class="hs-identifier hs-var">nullPtr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Chunk] -&gt; IO [Chunk]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">[Chunk]
</span><a href="#local-6989586621679566698"><span class="hs-identifier hs-var">accum</span></a></span><span>
</span><span id="line-101"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-102"></span><span>            </span><span id="local-6989586621679566696"><span class="annot"><span class="annottext">Chunk
</span><a href="#local-6989586621679566696"><span class="hs-identifier hs-var">chunk</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr Chunk -&gt; IO Chunk
</span><a href="GHC.ExecutionStack.Internal.html#peekChunk"><span class="hs-identifier hs-var">peekChunk</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Chunk
</span><a href="#local-6989586621679566697"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-103"></span><span>            </span><span class="annot"><span class="annottext">[Chunk] -&gt; Ptr Chunk -&gt; IO [Chunk]
</span><a href="#local-6989586621679566704"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Chunk
</span><a href="#local-6989586621679566696"><span class="hs-identifier hs-var">chunk</span></a></span><span> </span><span class="annot"><span class="annottext">Chunk -&gt; [Chunk] -&gt; [Chunk]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[Chunk]
</span><a href="#local-6989586621679566698"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Chunk -&gt; Ptr Chunk
</span><a href="GHC.ExecutionStack.Internal.html#chunkNext"><span class="hs-identifier hs-var hs-var">chunkNext</span></a></span><span> </span><span class="annot"><span class="annottext">Chunk
</span><a href="#local-6989586621679566696"><span class="hs-identifier hs-var">chunk</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="hs-comment">-- | Unpack the given 'Location' in the Haskell representation</span><span>
</span><span id="line-106"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#peekLocation"><span class="hs-identifier hs-type">peekLocation</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span>
</span><span id="line-107"></span><span id="peekLocation"><span class="annot"><span class="annottext">peekLocation :: Ptr Location -&gt; IO Location
</span><a href="GHC.ExecutionStack.Internal.html#peekLocation"><span class="hs-identifier hs-var hs-var">peekLocation</span></a></span></span><span> </span><span id="local-6989586621679566694"><span class="annot"><span class="annottext">Ptr Location
</span><a href="#local-6989586621679566694"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-108"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621679566693"><span class="hs-identifier hs-type">peekCStringPtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-109"></span><span>        </span><span id="local-6989586621679566693"><span class="annot"><span class="annottext">peekCStringPtr :: CString -&gt; IO String
</span><a href="#local-6989586621679566693"><span class="hs-identifier hs-var hs-var">peekCStringPtr</span></a></span></span><span> </span><span id="local-6989586621679566692"><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679566692"><span class="hs-identifier hs-var">p</span></a></span></span><span>
</span><span id="line-110"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679566692"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">CString -&gt; CString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">CString
forall a. Ptr a
</span><a href="GHC.Ptr.html#nullPtr"><span class="hs-identifier hs-var">nullPtr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CString -&gt; IO String
</span><a href="Foreign.C.String.html#peekCString"><span class="hs-identifier hs-var">peekCString</span></a></span><span> </span><span class="annot"><span class="annottext">(CString -&gt; IO String) -&gt; CString -&gt; IO String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CString -&gt; CString
forall a b. Ptr a -&gt; Ptr b
</span><a href="GHC.Ptr.html#castPtr"><span class="hs-identifier hs-var">castPtr</span></a></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679566692"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-111"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-112"></span><span>    </span><span id="local-6989586621679566690"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679566690"><span class="hs-identifier hs-var">objFile</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CString -&gt; IO String
</span><a href="#local-6989586621679566693"><span class="hs-identifier hs-var">peekCStringPtr</span></a></span><span> </span><span class="annot"><span class="annottext">(CString -&gt; IO String) -&gt; IO CString -&gt; IO String
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679566689"><span class="annot"><span class="annottext">Ptr Location
</span><a href="#local-6989586621679566689"><span class="hs-identifier hs-var">hsc_ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr Location -&gt; Int -&gt; IO CString
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; IO a
</span><a href="Foreign.Storable.html#peekByteOff"><span class="hs-identifier hs-var">peekByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Location
</span><a href="#local-6989586621679566689"><span class="hs-identifier hs-var">hsc_ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr Location
</span><a href="#local-6989586621679566694"><span class="hs-identifier hs-var">ptr</span></a></span><span>
</span><span id="line-113"></span><span class="hs-pragma">{-# LINE 113 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-113"></span><span>    </span><span class="hs-identifier">function</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peekCStringPtr</span><span> </span><span class="hs-operator">=&lt;&lt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">ptr</span><span>
</span><span id="line-114"></span><span class="hs-pragma">{-# LINE 114 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-identifier">srcFile</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peekCStringPtr</span><span> </span><span class="hs-operator">=&lt;&lt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">ptr</span><span>
</span><span id="line-115"></span><span class="hs-pragma">{-# LINE 115 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-identifier">lineNo</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">24</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">ptr</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Word32</span><span>
</span><span id="line-116"></span><span class="hs-pragma">{-# LINE 116 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-116"></span><span>    </span><span class="hs-identifier">colNo</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">28</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">ptr</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Word32</span><span>
</span><span id="line-117"></span><span class="hs-pragma">{-# LINE 117 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-117"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">_srcLoc</span><span>
</span><span id="line-118"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">srcFile</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-119"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Just</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">SrcLoc</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">sourceFile</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">srcFile</span><span>
</span><span id="line-120"></span><span>                                      </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sourceLine</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">lineNo</span><span>
</span><span id="line-121"></span><span>                                      </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sourceColumn</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">colNo</span><span>
</span><span id="line-122"></span><span>                                      </span><span class="hs-special">}</span><span>
</span><span id="line-123"></span><span>    </span><span class="annot"><span class="annottext">Location -&gt; IO Location
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Location :: String -&gt; String -&gt; Maybe SrcLoc -&gt; Location
</span><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">objectName :: String
</span><a href="GHC.ExecutionStack.Internal.html#objectName"><span class="hs-identifier hs-var">objectName</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679566690"><span class="hs-identifier hs-var">objFile</span></a></span><span>
</span><span id="line-124"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">functionName :: String
</span><a href="GHC.ExecutionStack.Internal.html#functionName"><span class="hs-identifier hs-var">functionName</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679566688"><span class="hs-identifier hs-var">function</span></a></span><span>
</span><span id="line-125"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">srcLoc :: Maybe SrcLoc
</span><a href="GHC.ExecutionStack.Internal.html#srcLoc"><span class="hs-identifier hs-var">srcLoc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe SrcLoc
</span><a href="#local-6989586621679566674"><span class="hs-identifier hs-var">_srcLoc</span></a></span><span>
</span><span id="line-126"></span><span>                    </span><span class="hs-special">}</span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="hs-comment">-- | The size in bytes of a 'locationSize'</span><span>
</span><span id="line-129"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#locationSize"><span class="hs-identifier hs-type">locationSize</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-130"></span><span id="locationSize"><span class="annot"><span class="annottext">locationSize :: Int
</span><a href="GHC.ExecutionStack.Internal.html#locationSize"><span class="hs-identifier hs-var hs-var">locationSize</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span class="hs-pragma">{-# LINE 131 &quot;libraries\\base\\GHC\\ExecutionStack\\Internal.hsc&quot; #-}</span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span class="hs-comment">-- | List the frames of a stack trace.</span><span>
</span><span id="line-133"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#stackFrames"><span class="hs-identifier hs-type">stackFrames</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-134"></span><span id="stackFrames"><span class="annot"><span class="annottext">stackFrames :: StackTrace -&gt; Maybe [Location]
</span><a href="GHC.ExecutionStack.Internal.html#stackFrames"><span class="hs-identifier hs-var hs-var">stackFrames</span></a></span></span><span> </span><span id="local-6989586621679566671"><span class="annot"><span class="annottext">st :: StackTrace
</span><a href="#local-6989586621679566671"><span class="hs-identifier hs-var">st</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span> </span><span id="local-6989586621679566670"><span class="annot"><span class="annottext">ForeignPtr StackTrace
</span><a href="#local-6989586621679566670"><span class="hs-identifier hs-var">fptr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (Maybe [Location]) -&gt; Maybe [Location]
forall a. IO a -&gt; a
</span><a href="GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Maybe [Location]) -&gt; Maybe [Location])
-&gt; IO (Maybe [Location]) -&gt; Maybe [Location]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(ForeignPtr Session -&gt; IO [Location]) -&gt; IO (Maybe [Location])
forall a. (ForeignPtr Session -&gt; IO a) -&gt; IO (Maybe a)
</span><a href="GHC.ExecutionStack.Internal.html#withSession"><span class="hs-identifier hs-var">withSession</span></a></span><span> </span><span class="annot"><span class="annottext">((ForeignPtr Session -&gt; IO [Location]) -&gt; IO (Maybe [Location]))
-&gt; (ForeignPtr Session -&gt; IO [Location]) -&gt; IO (Maybe [Location])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679566669"><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566669"><span class="hs-identifier hs-var">sess</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-135"></span><span>    </span><span id="local-6989586621679566668"><span class="annot"><span class="annottext">[Chunk]
</span><a href="#local-6989586621679566668"><span class="hs-identifier hs-var">chunks</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">StackTrace -&gt; IO [Chunk]
</span><a href="GHC.ExecutionStack.Internal.html#chunksList"><span class="hs-identifier hs-var">chunksList</span></a></span><span> </span><span class="annot"><span class="annottext">StackTrace
</span><a href="#local-6989586621679566671"><span class="hs-identifier hs-var">st</span></a></span><span>
</span><span id="line-136"></span><span>    </span><span class="annot"><span class="annottext">ForeignPtr Session -&gt; [Chunk] -&gt; IO [Location]
</span><a href="#local-6989586621679566667"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566669"><span class="hs-identifier hs-var">sess</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Chunk] -&gt; [Chunk]
forall a. [a] -&gt; [a]
</span><a href="GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Chunk]
</span><a href="#local-6989586621679566668"><span class="hs-identifier hs-var">chunks</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-137"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-138"></span><span>    </span><span class="annot"><a href="#local-6989586621679566667"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier hs-type">ForeignPtr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Session"><span class="hs-identifier hs-type">Session</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-139"></span><span>    </span><span id="local-6989586621679566667"><span class="annot"><span class="annottext">go :: ForeignPtr Session -&gt; [Chunk] -&gt; IO [Location]
</span><a href="#local-6989586621679566667"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Location] -&gt; IO [Location]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-140"></span><span>    </span><span class="annot"><a href="#local-6989586621679566667"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679566665"><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566665"><span class="hs-identifier hs-var">sess</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679566664"><span class="annot"><span class="annottext">Chunk
</span><a href="#local-6989586621679566664"><span class="hs-identifier hs-var">chunk</span></a></span></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span> </span><span id="local-6989586621679566663"><span class="annot"><span class="annottext">[Chunk]
</span><a href="#local-6989586621679566663"><span class="hs-identifier hs-var">chunks</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-141"></span><span>        </span><span id="local-6989586621679566662"><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566662"><span class="hs-identifier hs-var">this</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session -&gt; Chunk -&gt; IO [Location]
</span><a href="#local-6989586621679566661"><span class="hs-identifier hs-var">iterChunk</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566665"><span class="hs-identifier hs-var">sess</span></a></span><span> </span><span class="annot"><span class="annottext">Chunk
</span><a href="#local-6989586621679566664"><span class="hs-identifier hs-var">chunk</span></a></span><span>
</span><span id="line-142"></span><span>        </span><span id="local-6989586621679566660"><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566660"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO [Location] -&gt; IO [Location]
forall a. IO a -&gt; IO a
</span><a href="GHC.IO.Unsafe.html#unsafeInterleaveIO"><span class="hs-identifier hs-var">unsafeInterleaveIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignPtr Session -&gt; [Chunk] -&gt; IO [Location]
</span><a href="#local-6989586621679566667"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566665"><span class="hs-identifier hs-var">sess</span></a></span><span> </span><span class="annot"><span class="annottext">[Chunk]
</span><a href="#local-6989586621679566663"><span class="hs-identifier hs-var">chunks</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span>        </span><span class="annot"><span class="annottext">[Location] -&gt; IO [Location]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566662"><span class="hs-identifier hs-var">this</span></a></span><span> </span><span class="annot"><span class="annottext">[Location] -&gt; [Location] -&gt; [Location]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566660"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span>    </span><span class="hs-comment">{-
    Here we lazily lookup the location information associated with each address
    as this can be rather costly. This does mean, however, that if the set of
    loaded modules changes between the time that we capture the stack and the
    time we reach here, we may end up with nonsense (mostly likely merely
    unknown symbols). I think this is a reasonable price to pay, however, as
    module loading/unloading is a rather rare event.

    Moreover, we stand to gain a great deal by lazy lookups as the stack frames
    may never even be requested, meaning the only effort wasted is the
    collection of the stack frames themselves.

    The only slightly tricky thing here is to ensure that the ForeignPtr
    stays alive until we reach the end.
    -}</span><span>
</span><span id="line-160"></span><span>    </span><span class="annot"><a href="#local-6989586621679566661"><span class="hs-identifier hs-type">iterChunk</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier hs-type">ForeignPtr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Session"><span class="hs-identifier hs-type">Session</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Chunk"><span class="hs-identifier hs-type">Chunk</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-161"></span><span>    </span><span id="local-6989586621679566661"><span class="annot"><span class="annottext">iterChunk :: ForeignPtr Session -&gt; Chunk -&gt; IO [Location]
</span><a href="#local-6989586621679566661"><span class="hs-identifier hs-var hs-var">iterChunk</span></a></span></span><span> </span><span id="local-6989586621679566659"><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566659"><span class="hs-identifier hs-var">sess</span></a></span></span><span> </span><span id="local-6989586621679566658"><span class="annot"><span class="annottext">Chunk
</span><a href="#local-6989586621679566658"><span class="hs-identifier hs-var">chunk</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word -&gt; Ptr Addr -&gt; IO [Location]
</span><a href="#local-6989586621679566657"><span class="hs-identifier hs-var">iterFrames</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Chunk -&gt; Word
</span><a href="GHC.ExecutionStack.Internal.html#chunkFrames"><span class="hs-identifier hs-var hs-var">chunkFrames</span></a></span><span> </span><span class="annot"><span class="annottext">Chunk
</span><a href="#local-6989586621679566658"><span class="hs-identifier hs-var">chunk</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Chunk -&gt; Ptr Addr
</span><a href="GHC.ExecutionStack.Internal.html#chunkFirstFrame"><span class="hs-identifier hs-var hs-var">chunkFirstFrame</span></a></span><span> </span><span class="annot"><span class="annottext">Chunk
</span><a href="#local-6989586621679566658"><span class="hs-identifier hs-var">chunk</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-163"></span><span>        </span><span class="annot"><a href="#local-6989586621679566657"><span class="hs-identifier hs-type">iterFrames</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Addr"><span class="hs-identifier hs-type">Addr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-164"></span><span>        </span><span id="local-6989586621679566657"><span class="annot"><span class="annottext">iterFrames :: Word -&gt; Ptr Addr -&gt; IO [Location]
</span><a href="#local-6989586621679566657"><span class="hs-identifier hs-var hs-var">iterFrames</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Ptr Addr
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Location] -&gt; IO [Location]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-165"></span><span>        </span><span class="annot"><a href="#local-6989586621679566657"><span class="hs-identifier hs-var">iterFrames</span></a></span><span> </span><span id="local-6989586621679566656"><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679566656"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679566655"><span class="annot"><span class="annottext">Ptr Addr
</span><a href="#local-6989586621679566655"><span class="hs-identifier hs-var">frame</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-166"></span><span>            </span><span id="local-6989586621679566654"><span class="annot"><span class="annottext">Addr
</span><a href="#local-6989586621679566654"><span class="hs-identifier hs-var">pc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr Addr -&gt; IO Addr
forall a. Storable a =&gt; Ptr a -&gt; IO a
</span><a href="Foreign.Storable.html#peek"><span class="hs-identifier hs-var">peek</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Addr
</span><a href="#local-6989586621679566655"><span class="hs-identifier hs-var">frame</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Addr"><span class="hs-identifier hs-type">Addr</span></a></span><span>
</span><span id="line-167"></span><span>            </span><span id="local-6989586621679566652"><span class="annot"><span class="annottext">Maybe Location
</span><a href="#local-6989586621679566652"><span class="hs-identifier hs-var">mframe</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Addr -&gt; IO (Maybe Location)
</span><a href="#local-6989586621679566651"><span class="hs-identifier hs-var">lookupFrame</span></a></span><span> </span><span class="annot"><span class="annottext">Addr
</span><a href="#local-6989586621679566654"><span class="hs-identifier hs-var">pc</span></a></span><span>
</span><span id="line-168"></span><span>            </span><span id="local-6989586621679566650"><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566650"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO [Location] -&gt; IO [Location]
forall a. IO a -&gt; IO a
</span><a href="GHC.IO.Unsafe.html#unsafeInterleaveIO"><span class="hs-identifier hs-var">unsafeInterleaveIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word -&gt; Ptr Addr -&gt; IO [Location]
</span><a href="#local-6989586621679566657"><span class="hs-identifier hs-var">iterFrames</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679566656"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Word
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr Addr
forall a. Ptr a
</span><a href="#local-6989586621679566649"><span class="hs-identifier hs-var">frame'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>            </span><span class="annot"><span class="annottext">[Location] -&gt; IO [Location]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([Location] -&gt; IO [Location]) -&gt; [Location] -&gt; IO [Location]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Location]
-&gt; (Location -&gt; [Location]) -&gt; Maybe Location -&gt; [Location]
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566650"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Location -&gt; [Location] -&gt; [Location]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566650"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe Location
</span><a href="#local-6989586621679566652"><span class="hs-identifier hs-var">mframe</span></a></span><span>
</span><span id="line-170"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-171"></span><span>            </span><span id="local-6989586621679566649"><span class="annot"><span class="annottext">frame' :: Ptr b
</span><a href="#local-6989586621679566649"><span class="hs-identifier hs-var hs-var">frame'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr Addr
</span><a href="#local-6989586621679566655"><span class="hs-identifier hs-var">frame</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Addr -&gt; Int -&gt; Ptr b
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Addr -&gt; Int
forall a. Storable a =&gt; a -&gt; Int
</span><a href="Foreign.Storable.html#sizeOf"><span class="hs-identifier hs-var">sizeOf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Addr
forall a. HasCallStack =&gt; a
</span><a href="GHC.Err.html#undefined"><span class="hs-identifier hs-var">undefined</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Addr"><span class="hs-identifier hs-type">Addr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span>        </span><span class="annot"><a href="#local-6989586621679566651"><span class="hs-identifier hs-type">lookupFrame</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Addr"><span class="hs-identifier hs-type">Addr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-174"></span><span>        </span><span id="local-6989586621679566651"><span class="annot"><span class="annottext">lookupFrame :: Addr -&gt; IO (Maybe Location)
</span><a href="#local-6989586621679566651"><span class="hs-identifier hs-var hs-var">lookupFrame</span></a></span></span><span> </span><span id="local-6989586621679566642"><span class="annot"><span class="annottext">Addr
</span><a href="#local-6989586621679566642"><span class="hs-identifier hs-var">pc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ForeignPtr StackTrace
-&gt; (Ptr StackTrace -&gt; IO (Maybe Location)) -&gt; IO (Maybe Location)
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="GHC.ForeignPtr.html#withForeignPtr"><span class="hs-identifier hs-var">withForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr StackTrace
</span><a href="#local-6989586621679566670"><span class="hs-identifier hs-var">fptr</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr StackTrace -&gt; IO (Maybe Location)) -&gt; IO (Maybe Location))
-&gt; (Ptr StackTrace -&gt; IO (Maybe Location)) -&gt; IO (Maybe Location)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IO (Maybe Location) -&gt; Ptr StackTrace -&gt; IO (Maybe Location)
forall a b. a -&gt; b -&gt; a
</span><a href="GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Maybe Location) -&gt; Ptr StackTrace -&gt; IO (Maybe Location))
-&gt; IO (Maybe Location) -&gt; Ptr StackTrace -&gt; IO (Maybe Location)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-175"></span><span>            </span><span class="annot"><span class="annottext">Int -&gt; (Ptr Location -&gt; IO (Maybe Location)) -&gt; IO (Maybe Location)
forall a b. Int -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="Foreign.Marshal.Alloc.html#allocaBytes"><span class="hs-identifier hs-var">allocaBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.ExecutionStack.Internal.html#locationSize"><span class="hs-identifier hs-var">locationSize</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Location -&gt; IO (Maybe Location)) -&gt; IO (Maybe Location))
-&gt; (Ptr Location -&gt; IO (Maybe Location)) -&gt; IO (Maybe Location)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679566640"><span class="annot"><span class="annottext">Ptr Location
</span><a href="#local-6989586621679566640"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-176"></span><span>                </span><span id="local-6989586621679566639"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679566639"><span class="hs-identifier hs-var">ret</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session -&gt; (Ptr Session -&gt; IO CInt) -&gt; IO CInt
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="GHC.ForeignPtr.html#withForeignPtr"><span class="hs-identifier hs-var">withForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566659"><span class="hs-identifier hs-var">sess</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Session -&gt; IO CInt) -&gt; IO CInt)
-&gt; (Ptr Session -&gt; IO CInt) -&gt; IO CInt
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679566638"><span class="annot"><span class="annottext">Ptr Session
</span><a href="#local-6989586621679566638"><span class="hs-identifier hs-var">sessPtr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr Session -&gt; Ptr Location -&gt; Addr -&gt; IO CInt
</span><a href="GHC.ExecutionStack.Internal.html#libdw_lookup_location"><span class="hs-identifier hs-var">libdw_lookup_location</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Session
</span><a href="#local-6989586621679566638"><span class="hs-identifier hs-var">sessPtr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Location
</span><a href="#local-6989586621679566640"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">Addr
</span><a href="#local-6989586621679566642"><span class="hs-identifier hs-var">pc</span></a></span><span>
</span><span id="line-177"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679566639"><span class="hs-identifier hs-var">ret</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-178"></span><span>                  </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Location -&gt; Maybe Location
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(Location -&gt; Maybe Location) -&gt; IO Location -&gt; IO (Maybe Location)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Location -&gt; IO Location
</span><a href="GHC.ExecutionStack.Internal.html#peekLocation"><span class="hs-identifier hs-var">peekLocation</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Location
</span><a href="#local-6989586621679566640"><span class="hs-identifier hs-var">buf</span></a></span><span>
</span><span id="line-179"></span><span>                  </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Location -&gt; IO (Maybe Location)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Location
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span class="hs-comment">-- | A LibdwSession from the runtime system</span><span>
</span><span id="line-182"></span><span class="hs-keyword">data</span><span> </span><span id="Session"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Session"><span class="hs-identifier hs-var">Session</span></a></span></span><span>
</span><span id="line-183"></span><span>
</span><span id="line-184"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;libdwPoolTake&quot;</span></span><span>
</span><span id="line-185"></span><span>    </span><span id="libdw_pool_take"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#libdw_pool_take"><span class="hs-identifier hs-var">libdw_pool_take</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Session"><span class="hs-identifier hs-type">Session</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;libdwPoolRelease&quot;</span></span><span>
</span><span id="line-188"></span><span>    </span><span id="libdw_pool_release"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#libdw_pool_release"><span class="hs-identifier hs-var">libdw_pool_release</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#FunPtr"><span class="hs-identifier hs-type">FunPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Session"><span class="hs-identifier hs-type">Session</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;libdwPoolClear&quot;</span></span><span>
</span><span id="line-191"></span><span>    </span><span id="libdw_pool_clear"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#libdw_pool_clear"><span class="hs-identifier hs-var">libdw_pool_clear</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;libdwLookupLocation&quot;</span></span><span>
</span><span id="line-194"></span><span>    </span><span id="libdw_lookup_location"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#libdw_lookup_location"><span class="hs-identifier hs-var">libdw_lookup_location</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Session"><span class="hs-identifier hs-type">Session</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Addr"><span class="hs-identifier hs-type">Addr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;libdwGetBacktrace&quot;</span></span><span>
</span><span id="line-197"></span><span>    </span><span id="libdw_get_backtrace"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#libdw_get_backtrace"><span class="hs-identifier hs-var">libdw_get_backtrace</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Session"><span class="hs-identifier hs-type">Session</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;backtraceFree&quot;</span></span><span>
</span><span id="line-200"></span><span>    </span><span id="backtrace_free"><span class="annot"><a href="GHC.ExecutionStack.Internal.html#backtrace_free"><span class="hs-identifier hs-var">backtrace_free</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#FunPtr"><span class="hs-identifier hs-type">FunPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span class="hs-comment">-- | Get an execution stack.</span><span>
</span><span id="line-203"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#collectStackTrace"><span class="hs-identifier hs-type">collectStackTrace</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-type">StackTrace</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span id="collectStackTrace"><span class="annot"><span class="annottext">collectStackTrace :: IO (Maybe StackTrace)
</span><a href="GHC.ExecutionStack.Internal.html#collectStackTrace"><span class="hs-identifier hs-var hs-var">collectStackTrace</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe (Maybe StackTrace) -&gt; Maybe StackTrace)
-&gt; IO (Maybe (Maybe StackTrace)) -&gt; IO (Maybe StackTrace)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Maybe StackTrace) -&gt; Maybe StackTrace
forall (m :: * -&gt; *) a. Monad m =&gt; m (m a) -&gt; m a
</span><a href="GHC.Base.html#join"><span class="hs-identifier hs-var">join</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Maybe (Maybe StackTrace)) -&gt; IO (Maybe StackTrace))
-&gt; IO (Maybe (Maybe StackTrace)) -&gt; IO (Maybe StackTrace)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(ForeignPtr Session -&gt; IO (Maybe StackTrace))
-&gt; IO (Maybe (Maybe StackTrace))
forall a. (ForeignPtr Session -&gt; IO a) -&gt; IO (Maybe a)
</span><a href="GHC.ExecutionStack.Internal.html#withSession"><span class="hs-identifier hs-var">withSession</span></a></span><span> </span><span class="annot"><span class="annottext">((ForeignPtr Session -&gt; IO (Maybe StackTrace))
 -&gt; IO (Maybe (Maybe StackTrace)))
-&gt; (ForeignPtr Session -&gt; IO (Maybe StackTrace))
-&gt; IO (Maybe (Maybe StackTrace))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679566633"><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566633"><span class="hs-identifier hs-var">sess</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-205"></span><span>    </span><span id="local-6989586621679566632"><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566632"><span class="hs-identifier hs-var">st</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session
-&gt; (Ptr Session -&gt; IO (Ptr StackTrace)) -&gt; IO (Ptr StackTrace)
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="GHC.ForeignPtr.html#withForeignPtr"><span class="hs-identifier hs-var">withForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Session
</span><a href="#local-6989586621679566633"><span class="hs-identifier hs-var">sess</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Session -&gt; IO (Ptr StackTrace)
</span><a href="GHC.ExecutionStack.Internal.html#libdw_get_backtrace"><span class="hs-identifier hs-var">libdw_get_backtrace</span></a></span><span>
</span><span id="line-206"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566632"><span class="hs-identifier hs-var">st</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace -&gt; Ptr StackTrace -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace
forall a. Ptr a
</span><a href="GHC.Ptr.html#nullPtr"><span class="hs-identifier hs-var">nullPtr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe StackTrace -&gt; IO (Maybe StackTrace)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe StackTrace
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-207"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">StackTrace -&gt; Maybe StackTrace
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(StackTrace -&gt; Maybe StackTrace)
-&gt; (ForeignPtr StackTrace -&gt; StackTrace)
-&gt; ForeignPtr StackTrace
-&gt; Maybe StackTrace
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr StackTrace -&gt; StackTrace
</span><a href="GHC.ExecutionStack.Internal.html#StackTrace"><span class="hs-identifier hs-var">StackTrace</span></a></span><span> </span><span class="annot"><span class="annottext">(ForeignPtr StackTrace -&gt; Maybe StackTrace)
-&gt; IO (ForeignPtr StackTrace) -&gt; IO (Maybe StackTrace)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">FinalizerPtr StackTrace
-&gt; Ptr StackTrace -&gt; IO (ForeignPtr StackTrace)
forall a. FinalizerPtr a -&gt; Ptr a -&gt; IO (ForeignPtr a)
</span><a href="Foreign.ForeignPtr.Imp.html#newForeignPtr"><span class="hs-identifier hs-var">newForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">FinalizerPtr StackTrace
</span><a href="GHC.ExecutionStack.Internal.html#backtrace_free"><span class="hs-identifier hs-var">backtrace_free</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr StackTrace
</span><a href="#local-6989586621679566632"><span class="hs-identifier hs-var">st</span></a></span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span class="hs-comment">-- | Free the cached debug data.</span><span>
</span><span id="line-210"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#invalidateDebugCache"><span class="hs-identifier hs-type">invalidateDebugCache</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span id="invalidateDebugCache"><span class="annot"><span class="annottext">invalidateDebugCache :: IO ()
</span><a href="GHC.ExecutionStack.Internal.html#invalidateDebugCache"><span class="hs-identifier hs-var hs-var">invalidateDebugCache</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ()
</span><a href="GHC.ExecutionStack.Internal.html#libdw_pool_clear"><span class="hs-identifier hs-var">libdw_pool_clear</span></a></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span class="hs-comment">-- | Render a stacktrace as a string</span><span>
</span><span id="line-214"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#showStackFrames"><span class="hs-identifier hs-type">showStackFrames</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span><span>
</span><span id="line-215"></span><span id="showStackFrames"><span class="annot"><span class="annottext">showStackFrames :: [Location] -&gt; ShowS
</span><a href="GHC.ExecutionStack.Internal.html#showStackFrames"><span class="hs-identifier hs-var hs-var">showStackFrames</span></a></span></span><span> </span><span id="local-6989586621679566631"><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566631"><span class="hs-identifier hs-var">frames</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-216"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Stack trace:\n&quot;</span></span><span>
</span><span id="line-217"></span><span>    </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(ShowS -&gt; ShowS -&gt; ShowS) -&gt; ShowS -&gt; [ShowS] -&gt; ShowS
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">(.)</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS
forall a. a -&gt; a
</span><a href="GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Location -&gt; ShowS) -&gt; [Location] -&gt; [ShowS]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Location -&gt; ShowS
</span><a href="#local-6989586621679566628"><span class="hs-identifier hs-var">showFrame</span></a></span><span> </span><span class="annot"><span class="annottext">[Location]
</span><a href="#local-6989586621679566631"><span class="hs-identifier hs-var">frames</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-219"></span><span>    </span><span id="local-6989586621679566628"><span class="annot"><span class="annottext">showFrame :: Location -&gt; ShowS
</span><a href="#local-6989586621679566628"><span class="hs-identifier hs-var hs-var">showFrame</span></a></span></span><span> </span><span id="local-6989586621679566627"><span class="annot"><span class="annottext">Location
</span><a href="#local-6989586621679566627"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-220"></span><span>      </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;    &quot;</span></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Location -&gt; ShowS
</span><a href="GHC.ExecutionStack.Internal.html#showLocation"><span class="hs-identifier hs-var">showLocation</span></a></span><span> </span><span class="annot"><span class="annottext">Location
</span><a href="#local-6989586621679566627"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; ShowS
</span><a href="GHC.Show.html#showChar"><span class="hs-identifier hs-var">showChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span class="hs-comment">-- | Render a 'Location' as a string</span><span>
</span><span id="line-223"></span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#showLocation"><span class="hs-identifier hs-type">showLocation</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#Location"><span class="hs-identifier hs-type">Location</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span><span>
</span><span id="line-224"></span><span id="showLocation"><span class="annot"><span class="annottext">showLocation :: Location -&gt; ShowS
</span><a href="GHC.ExecutionStack.Internal.html#showLocation"><span class="hs-identifier hs-var hs-var">showLocation</span></a></span></span><span> </span><span id="local-6989586621679566624"><span class="annot"><span class="annottext">Location
</span><a href="#local-6989586621679566624"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-225"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Location -&gt; String
</span><a href="GHC.ExecutionStack.Internal.html#functionName"><span class="hs-identifier hs-var hs-var">functionName</span></a></span><span> </span><span class="annot"><span class="annottext">Location
</span><a href="#local-6989586621679566624"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; (SrcLoc -&gt; ShowS) -&gt; Maybe SrcLoc -&gt; ShowS
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS
forall a. a -&gt; a
</span><a href="GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc -&gt; ShowS
</span><a href="#local-6989586621679566623"><span class="hs-identifier hs-var">showSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Location -&gt; Maybe SrcLoc
</span><a href="GHC.ExecutionStack.Internal.html#srcLoc"><span class="hs-identifier hs-var hs-var">srcLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Location
</span><a href="#local-6989586621679566624"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; in &quot;</span></span><span>
</span><span id="line-228"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Location -&gt; String
</span><a href="GHC.ExecutionStack.Internal.html#objectName"><span class="hs-identifier hs-var hs-var">objectName</span></a></span><span> </span><span class="annot"><span class="annottext">Location
</span><a href="#local-6989586621679566624"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-229"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-230"></span><span>    </span><span class="annot"><a href="#local-6989586621679566623"><span class="hs-identifier hs-type">showSrcLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.ExecutionStack.Internal.html#SrcLoc"><span class="hs-identifier hs-type">SrcLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span><span>
</span><span id="line-231"></span><span>    </span><span id="local-6989586621679566623"><span class="annot"><span class="annottext">showSrcLoc :: SrcLoc -&gt; ShowS
</span><a href="#local-6989586621679566623"><span class="hs-identifier hs-var hs-var">showSrcLoc</span></a></span></span><span> </span><span id="local-6989586621679566622"><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621679566622"><span class="hs-identifier hs-var">sloc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-232"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; (&quot;</span></span><span>
</span><span id="line-233"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; String
</span><a href="GHC.ExecutionStack.Internal.html#sourceFile"><span class="hs-identifier hs-var hs-var">sourceFile</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621679566622"><span class="hs-identifier hs-var">sloc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-234"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;:&quot;</span></span><span>
</span><span id="line-235"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; ShowS
forall a. Show a =&gt; a -&gt; ShowS
</span><a href="GHC.Show.html#shows"><span class="hs-identifier hs-var">shows</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; Int
</span><a href="GHC.ExecutionStack.Internal.html#sourceLine"><span class="hs-identifier hs-var hs-var">sourceLine</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621679566622"><span class="hs-identifier hs-var">sloc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-236"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.&quot;</span></span><span>
</span><span id="line-237"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; ShowS
forall a. Show a =&gt; a -&gt; ShowS
</span><a href="GHC.Show.html#shows"><span class="hs-identifier hs-var">shows</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; Int
</span><a href="GHC.ExecutionStack.Internal.html#sourceColumn"><span class="hs-identifier hs-var hs-var">sourceColumn</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621679566622"><span class="hs-identifier hs-var">sloc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-238"></span><span>      </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)&quot;</span></span><span>
</span><span id="line-239"></span></pre></body></html>